﻿<%@ WebHandler Language="C#" Class="Patient_Search" %>

using System;
using System.Web;
using System.Collections.Generic;
using System.Text;
using IDML.BusinessObject;
using IDML.BusinessLogic;

public class Patient_Search : IHttpHandler
{
    public void ProcessRequest(HttpContext context)
    {
        string prefixText = context.Request.QueryString["q"];
        PatientBL patientBL = new PatientBL();
        if (prefixText != null)
        {
            List<PatientBO> pbList = patientBL.Patient_SearchWithText(prefixText);
            StringBuilder sb = new StringBuilder();
            foreach (PatientBO item in pbList)
            {
                sb.Append(item.FirstName + " " + item.LastName)
                          .Append(Environment.NewLine);
            }
            context.Response.Write(sb.ToString());
        }
    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }
}